home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / print / cramv33.arj / FILTER.C < prev    next >
Text File  |  1991-10-12  |  733b  |  41 lines

  1. #include <stdio.h>
  2.  
  3. void    _nullcheck();
  4. void    _setenvp();
  5. void    _setargv();
  6.  
  7. #define    REC_SIZE 256
  8.  
  9. int     main ()
  10.  
  11. {
  12.     int    status = 0;
  13.     char     file_buf[REC_SIZE];
  14.  
  15.     while ( (status = fread (file_buf, 1, REC_SIZE, stdin) ) != 0 ) {
  16.       filter_rec (file_buf, status);
  17.     }
  18.     return (0);
  19. }
  20.  
  21. void    _nullcheck () {};
  22. void    _setenvp () {};
  23. void    _setargv () {};
  24.  
  25.  
  26. int     filter_rec (file_buf, record_size)
  27.  
  28. char      *file_buf;
  29. int    record_size;
  30. {
  31.     int    i;
  32.     static  int    cr_detected = 0;
  33.  
  34.     for (i = 0; i < record_size; i++) {
  35.       if (file_buf[i] == 0x0D) cr_detected = 1;
  36.       if (file_buf[i] == 0x0A) cr_detected = 0;
  37.       if (!cr_detected) putc (file_buf[i], stdout);
  38.         };
  39.         return 1;
  40. }
  41.